package com.itheima.consumer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfiguration {

    @Bean
    public FanoutExchange fanoutExchange() {

//        ExchangeBuilder.fanoutExchange("pengge.fanout3").build();

        return new FanoutExchange("penge.fanout2");
    }

    @Bean
    public Queue fanoutQueue3() {
        //持久化
//        QueueBuilder.durable("ff");

        return new Queue("fanout.queue3");
    }


    @Bean
    public Binding fanoutBinding3(Queue fanoutQueue3, FanoutExchange fanoutExchange) {
        //绑定队列          绑定交换机
        return BindingBuilder.bind(fanoutQueue3).to(fanoutExchange);
    }


    @Bean
    public Queue fanoutQueue4() {
        //持久化
        QueueBuilder.durable("ff");

        return new Queue("fanout.queue4");
    }


    @Bean
    public Binding fanoutBinding4() {
        //绑定队列          绑定交换机
        return BindingBuilder.bind(fanoutQueue4()).to(fanoutExchange());
    }


}
